#include <stdlib.h>
#include <stdio.h>

#include "graphobj.h"


int doit(void *w)
{
  char *str;
  str = askString("pplua","Write something","something");
  displayWarningMsg("You wrote:", str, "Ok", NULL, NULL);
  return 1;
}

  windowDef w;
  buttonDef b;
  menuBarDef mb;
  menuDef m;

int close(void *w)
{
  return 0;
}

void mainApp(int argc, char **argv)
{
  
  b.area.objId = ButtonId;
  b.area.winId = &w.winId;
  b.area.left = 2;
  b.area.top  = 32;
  b.area.width  = 70;
  b.area.height = 20;
  b.rst   = NULL;
  b.state = FALSE;
  b.label = "Do it";
  b.callback = doit;
  
  w.close = close;
  
  addObject(&w, (grObjDef *)&b);
  
  addWindow(&w, TO_CENTER, TO_CENTER, "Builder", 
            100, 100);
  
  mb.area.objId = MenuBarId;
  mb.area.winId = &w.winId;
  mb.area.left = 5;
  mb.area.top = 0;
/*
  mb.area.width = windowWidth - 5;
  mb.area.height = lineHeight + 2*DELTA;
*/
  mb.area.resizeType = RESIZE_NONE;
  mb.delta = 2;

  addObject(&w, (grObjDef *) &mb);

  m.area.objId = MenuId;
  m.area.winId = &w.winId;
  m.area.left = 155;
  m.area.top = 0;
  m.area.width = 100;
  m.area.height = 20;
  m.area.resizeType = RESIZE_NONE;
  m.title = "File";
  m.rst   = NULL;
  m.items[0].label = "Save...       <F5>";
  m.items[0].state = TRUE;
  m.items[0].callback = NULL;

  m.nbItems = 1;
  m.state = FALSE;
  m.selectedItem = 0;
  menuBarAdd(&mb, &m);

  
  mainLoop();
  
  
}
